package tests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import base.items.Photo;


public class PhotoTest {

	private Photo p=null;
	private HashSet<Integer> tags = new HashSet<Integer>();
	private HashSet<Integer> comments = new HashSet<Integer>();
	@Before
	public void setup(){
	}

	@After
	public void tearUp(){
		p=null;
	}

	@Test
	public void constructorNotNull(){
		p=new Photo(0, "Photo",tags,comments,"Nice",800,600);
		assertNotNull(p);
	}

	@Test (expected=IllegalArgumentException.class)
	public void constructorValidId(){
		p=new Photo(-1,"Test",tags,comments,"Nice",800,600);
	}

	@Test
	public void correctType(){
		p=new Photo(0, "Photo",tags,comments,"Nice",800,600);
		String actual = p.getType();
		String expected = "Photo";
		assertTrue(expected.equals(actual));
	}

	
	@Test
	public void toStringOk(){
		tags.add(23);
		p=new Photo(0, "Photo",tags,comments,"Nice",800,600);
		String actual = p.toString();
		String expected = "Item Id: 0" +
				"\nOwner: 2" +
				"\nType: Photo"+
				"\nTitle: Photo" +
				"\nLocation: Nice" +
				"\nResolution: 800x600"+
				"\n\t* Tag n°" + 23;
		assertTrue(expected.equals(actual));
	}
}
